﻿#ifndef COMPUTERDISPLAYWIDGET_H
#define COMPUTERDISPLAYWIDGET_H

#include <QDialog>
#include "computeralarmlog.h"
#include "computer.h"

#define MAX_DISPLAYED_LOGS_COUNT 1000

#define AlarmReqType_UNLIMIT 0

typedef enum
{
    IS_READ_QUERY_MODE_UNLIMIT,
    IS_READ_QUERY_MODE_SUCCESSFUL,
    IS_READ_QUERY_MODE_FAILED
}IS_READ_QUERY_MODE;

namespace Ui {
class ComputerDisplayWidget;
}

class ComputerDisplayWidget : public QDialog
{
    Q_OBJECT

public:
    explicit ComputerDisplayWidget(Computer &computer, QWidget *parent = 0);
    ~ComputerDisplayWidget();

    void displayLogs();

    void displayAppRunningInfos();

    void drawCPU(list<float>cpus);

    void drawMemory(list<float>mems);

    void drawDisks(list<DiskInfo> disks);


private:
    Ui::ComputerDisplayWidget *ui;

    list<ComputerAlarmLog *> logs;

    Computer computer;

    int currentPageNum = 1;

    int pageSize = 20;

    void getQueryConditionsFromUI(QString* & alarmType, QString* & alarmMode, QString* & isRead);

    void getCurrentClientInfo();

private slots:
   void reloadWithQueryConditions();
   void on_pushButton_clicked();
   void on_prePageButton_clicked();
   void on_nextPageButton_clicked();
   void on_endPageButton_clicked();
   void on_firtPageButton_clicked();
   void on_queryButton_clicked();
   void on_deleteButton_clicked();
   void on_markButton_clicked();
   void on_remoteCtrlPushButton_clicked(bool checked);
   void on_refreshRunningInfoPushButton_clicked();
   void on_refreshButton_clicked();
   void delayGetClientInfo();
   void delayDisplayAppInfo();
};

#endif // COMPUTERDISPLAYWIDGET_H
